package com.xtravel.tweet.api;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.xtravel.common.api.BaseRequest;
import com.xtravel.common.api.domain.BaseJson;
import com.xtravel.common.helper.JsonHelper;
import com.xtravel.tweet.database.dto.Tweet;


public class TweetRequest extends BaseRequest {

    public TweetRequest() {

    }

    public TweetJson weiboList(Long sinceId, Long maxId, Integer count) {
        String response = api("/weibo/list/?/?/?", sinceId, maxId, count);
        Gson gson = new Gson();
        return gson.fromJson(response, TweetJson.class);
    }

    public BaseJson tweet(Integer tweetId) {
        String response = api("/tweet/detail/?", tweetId);
        return JsonHelper.fromJson(response, new TypeToken<BaseJson<Tweet>>() {
        });
    }
}
